#ifndef __CORE_COMMON_CONFIGURE_BASE_H_INCLUDE__
#define __CORE_COMMON_CONFIGURE_BASE_H_INCLUDE__

#include <core/common/string.h>
#include <t3party/libjson/value.h>

namespace core{ namespace common
{
	class ModuleConfigure
	{
	public:
		bool enabled_;
		std::string name_;

		ModuleConfigure();
		virtual ~ModuleConfigure();

		virtual bool load( const json::Value &node );
	};

	class LogConfigure : public ModuleConfigure
	{
	public:
		uint32 type_;
		uint32 level_;
		std::string typeString_;
		std::string levelString_;
		std::string file_;
		bool   append_;
		uint32 timeCapacity_;
		uint64 sizeCapacity_;
		bool   timeMilliSeconds_;

		LogConfigure();
		~LogConfigure();

		virtual bool load( const json::Value &node );
		std::string getTypeName();
		std::string getLevelName();
	};

	class Configure
	{
	protected:
		json::Value document_;

		Configure();
		virtual ~Configure();

	public:
		std::string path_;
		std::string file_;
		std::string shareName_;
		std::string notifierName_;
		uint32 heartbeatInterval_;

		// sub-configures
		LogConfigure     log_;

		virtual bool load( const std::string &file, void *param );
		virtual bool loadBuffer( const std::string &buffer, void *param );
		virtual bool loadDocument();
		virtual void traceSummary();
	};
}}

#endif //__CORE_COMMON_CONFIGURE_BASE_H_INCLUDE__
